﻿using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class UITips : MonoBehaviour
{
    public static UITips Instance;

    public GameObject root;
    public Text textContent;


    private void Awake()
    {
        Instance = this;
    }

    private void OnDestroy()
    {
        Instance = null;
    }

    private void SetVisible(bool isActive)
    {
        this.root.SetActive(isActive);
    }
    public void Show(string content)
    {
        //if (this.root.activeSelf)
        //{
        //    Debug.LogError("程序出bug了，Demo阶段没支持缓存多个show UIDialog");
        //    return;
        //}
        this.textContent.text = content;
        SetVisible(true);
        Invoke(nameof(SetInVisible), 2);
    }

   private void SetInVisible()
    {
        SetVisible(false);
    }
}
